import Layout from '@/view/layout/Layout'
/**
 * meta: {
 *  auth: true // 需要登录才能访问的组件配置为true
 * }
 */

export default [{
        path: '/404',
        component: () =>
            import ('@/view/404')
    },
    {
        path: '',
        redirect: '/home',
        component: Layout,
        // component: () =>
        //     import ('@/view/common/Home.vue'),
        children: [{
            path: '/home',
            name: 'home',
            component: () =>
                import ('@/view/common/Home.vue')
        }, ]
    },
    {
        path: '/help',
        component: Layout,
        // name: 'help',
        children: [{
            path: '/help',
            name: 'help',
            component: () =>
                import ('@/view/help/Help.vue')
        }]

    },
    {
        path: '/:uuid(\\d+)',
        // name: 'account',
        // component: () =>
        // import ('@/view/account/Account.vue'),
        component: Layout,
        children: [{
            path: '/:uuid(\\d+)',
            name: 'account',
            component: () =>
                import ('@/view/account/Account.vue'),
            meta: {
                auth: true,
            },
        }, {
            path: '/:uuid(\\d+)/star',
            name: 'star',
            component: () =>
                import ('@/view/account/Star.vue'),
            meta: {
                auth: true,
            },
        }],
    },
    {
        path: '/user-center',
        // redirect: '/user-center/setting',
        component: Layout,
        children: [{
            path: '/user-center',
            name: 'user-center-setting',
            component: () =>
                import ('@/view/user-center/Setting.vue')
        }]
    },
    // 顺序很重要
    {
        path: '/search',
        // name: 'message',
        component: Layout,
        children: [{
            path: '/search',
            name: 'search',
            component: () =>
                import ('@/view/search/Search.vue'),
        }],
    },
    {
        path: '/message',
        // name: 'message',
        component: Layout,
        children: [{
            path: '/message',
            name: 'message',
            component: () =>
                import ('@/view/message/Message.vue'),
            meta: {
                auth: true
            },
        }],
    },
    {
        path: '/news',
        name: 'news',
        component: () =>
            import ('@/view/news/News.vue'),
        meta: {
            auth: true
        }
    },
    {
        path: '/history',
        name: 'history',
        component: () =>
            import ('@/view/history/History.vue'),
        meta: {
            auth: true
        }
    },
    {
        path: '/platform',
        name: 'platform',
        component: () =>
            import ('@/view/platform/Platform.vue'),
        meta: {
            auth: true
        }
    },
    {
        path: '/platform/upload',
        component: Layout,
        children: [{
            path: '/platform/upload',
            name: 'upload',
            component: () =>
                import ('@/view/platform/upload.vue'),
            meta: {
                auth: true
            }
        }],
    },
    {
        path: '/video/:uvid(\\d+)',
        component: Layout,
        children: [{
            path: '/video/:uvid(\\d+)',
            name: 'video',
            component: () =>
                import ('@/view/video/Video.vue'),
        }]
    },
    {
        path: '/login',
        // name: 'login',
        // component: () =>
        //     import ('@/view/common/login.vue'),
        component: Layout,
        children: [{
            path: '/login',
            name: 'login',
            component: () =>
                import ('@/view/common/login.vue')
        }]
    },
    {
        path: '/register',
        // name: 'register',
        // component: () =>
        // import ('@/view/common/Register.vue'),
        component: Layout,
        children: [{
            path: '/register',
            name: 'register',
            component: () =>
                import ('@/view/common/Register.vue')
        }]
    },
    {
        path: '/welcome',
        component: Layout,
        children: [{
            path: '/welcome',
            name: 'welcome',
            component: () =>
                import ('@/view/common/Welcome.vue')
        }]
    },
    { path: '*', redirect: '/404' }
]